#ifndef SCRIPTGENERATOR_H
#define SCRIPTGENERATOR_H

#include<QDesktopServices>
#include<QDialog>
#include<QDialogButtonBox>
#include<QFormLayout>
#include<QLineEdit>
#include<QLabel>
#include<QIntValidator>
#include<QDoubleValidator>
#include<QWidget>
#include<QHBoxLayout>
#include<QCheckBox>
#include<QMessageBox>
#include<QComboBox>
#include<QUrl>

#include"ActionType.h"
#include"EventType.h"
#include"TargetType.h"
#include"ScriptEntryRaw.h"

class ScriptGenerator: public QDialog{
Q_OBJECT
public:
	ScriptGenerator(QWidget *parent = 0);
	ScriptGenerator(ScriptEntryRaw *script, QWidget *parent = 0);
	~ScriptGenerator();
    void init();
	
	ScriptEntryRaw *getSQL(QString &sql, QString &comment);
private:
	ScriptEntryRaw *m_script;
	bool m_scriptUsed;
	QFormLayout *m_layout;
	
	QLineEdit *m_editLink;
	QLineEdit *m_editPhaseMask;
	QLineEdit *m_editChance;
	QWidget *m_eventFlagsWidget;
	QHBoxLayout *m_eventFlagsLayout;
	QCheckBox *m_checkRepeat, *m_check0, *m_check1, *m_check2, *m_check3, *m_checkDebug;
	QComboBox *m_comboEventType;
	QWidget *m_eventParamWidget;
	QHBoxLayout *m_eventParamLayout;
	
	QWidget *m_eventParamWidget1, *m_eventParamWidget2, *m_eventParamWidget3, *m_eventParamWidget4;
	QVBoxLayout *m_eventParamLayout1, *m_eventParamLayout2, *m_eventParamLayout3, *m_eventParamLayout4;
	
	QLineEdit *m_editEventParam1, *m_editEventParam2, *m_editEventParam3, *m_editEventParam4;
	QLabel *m_eventParam1Description;
	QLabel *m_eventParam2Description;
	QLabel *m_eventParam3Description;
	QLabel *m_eventParam4Description;
	
	QComboBox *m_comboActionType;
	QWidget *m_actionWidget;
	QHBoxLayout *m_actionLayout;
	QLineEdit *m_actionParam1, *m_actionParam2, *m_actionParam3, *m_actionParam4, *m_actionParam5, *m_actionParam6;
	
	QWidget *m_actionParamWidget1, *m_actionParamWidget2, *m_actionParamWidget3, *m_actionParamWidget4, *m_actionParamWidget5, *m_actionParamWidget6;
	QVBoxLayout *m_actionParamLayout1, *m_actionParamLayout2, *m_actionParamLayout3, *m_actionParamLayout4, *m_actionParamLayout5, *m_actionParamLayout6;
	QLabel *m_actionParam1Description;
	QLabel *m_actionParam2Description;
	QLabel *m_actionParam3Description;
	QLabel *m_actionParam4Description;
	QLabel *m_actionParam5Description;
	QLabel *m_actionParam6Description;
	
	QComboBox *m_comboTarget;
	QLineEdit *m_comments;
	QWidget *m_targetWidget2;
	QHBoxLayout *m_targetLayout2;
	QWidget *m_targetDescriptionWidget1;
	QWidget *m_targetDescriptionWidget2;
	QWidget *m_targetDescriptionWidget3;
	QVBoxLayout *m_targetDescriptionLayout1;
	QVBoxLayout *m_targetDescriptionLayout2;
	QVBoxLayout *m_targetDescriptionLayout3;
	QLineEdit *m_editTarget1;
	QLineEdit *m_editTarget2;
	QLineEdit *m_editTarget3;
	QLabel *m_targetDescription1, *m_targetDescription2, *m_targetDescription3;
	QWidget *m_targetWidget;
	QHBoxLayout *m_targetLayout;
	QLineEdit *m_editTargetX, *m_editTargetY, *m_editTargetZ, *m_editTargetO;
	QLabel *m_labelX, *m_labelY, *m_labelZ, *m_labelO;
	QDialogButtonBox *m_buttons;
private slots:
	void slotAccepted();
	void slotRejected();
    void slotHelpRequested();
	void slotEventTypeChanged(int current);
	void slotActionTypeChanged(int current);
	void slotTargetChanged(int current);
};

#endif
